// 配置路由，导出路由实例
import VueRouter from 'vue-router'
import Vue from 'vue'

// 组件
import Hero from './views/hero.vue'
import HeroAdd from './views/hero-add.vue'
import HeroEdit from './views/hero-edit.vue'
import Zb from './views/zb.vue'
import Jn from './views/jn.vue'

Vue.use(VueRouter)

// 路由规则
const routes = [
  // 默认访问英雄列表
  {path: '/', redirect: '/hero'},
  {path: '/hero', component: Hero},
  {path: '/hero/add', component: HeroAdd},
  {path: '/hero/edit/:id', component: HeroEdit},
  {path: '/zb', component: Zb},
  {path: '/jn', component: Jn}
]

// 初始化
const router = new VueRouter({
  routes,
  linkActiveClass: 'active'
})

export default router
